package com.xiaoyu.lanling.feature.setting.activity

import android.os.Bundle
import com.xiaoyu.base.utils.extensions.setOnClickDebounceListener
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.activity.base.AppCompatToolbarActivity
import com.xiaoyu.lanling.common.Constant
import com.xiaoyu.lanling.feature.login.data.LoginData
import com.xiaoyu.lanling.router.Router
import kotlinx.android.synthetic.main.activity_setting.*

class SettingActivity : AppCompatToolbarActivity() {

    override fun onCreateSafelyAfterAppFinishInit(savedInstanceState: Bundle?) {
        super.onCreateSafelyAfterAppFinishInit(savedInstanceState)
        setLightStatusBar()
        setContentView(R.layout.activity_setting)
        initToolbar()

        initView()
        initBind()
    }

    private fun initView() {
        title = getString(R.string.setting_title)
    }

    private fun initBind() {
        notification_layout.setOnClickDebounceListener {
            Router.instance.gotoNotificationActivity(this)
        }
        feedback_layout.setOnClickDebounceListener {
            Router.instance.gotoFeedbackActivity(this, Constant.FeedbackType.FEEDBACK)
        }
        about_us_layout.setOnClickDebounceListener {
            Router.instance.gotoAboutUsActivity(this)
        }
        prize_layout.setOnClickDebounceListener {
            Router.instance.gotoSettingPrizeActivity(this)
        }
        logout.setOnClickDebounceListener {
            LoginData.logout(Any())
        }
    }
}